package com.itheima.mapper;

import com.itheima.pojo.entity.CheckGroup;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CheckGroupMapper {

    @Select("select setmeal_id from t_setmeal_checkgroup where setmeal_id=#{id}")
    List<Integer> findCheckGroupIdsBySetmealId(Integer id);

    @Select("SELECT * FROM t_checkgroup")
    List<CheckGroup> findAll();

    @Update("UPDATE t_checkgroup SET code=#{code}, name=#{name}, helpCode=#{helpCode}, sex=#{sex}, remark=#{remark}, attention=#{attention} WHERE id=#{id}")
    void updateCheckGroup(CheckGroup checkGroup);

    @Select("SELECT * FROM t_checkgroup WHERE id=#{id}")
    CheckGroup findByIdCheckGroup(Integer integer);

    @Insert("INSERT INTO t_checkgroup(code, name, helpCode, sex, remark, attention) VALUES(#{code}, #{name}, #{helpCode}, #{sex}, #{remark}, #{attention})")
    void insertCheckGroup(CheckGroup checkGroup);

    @Delete("DELETE FROM t_checkgroup WHERE id=#{id}")
    void deleteById(Integer integer);
}
